package com.redroid.findme;

/*
 *start.java
 *Purpose: Menu inicial do app
 * 
 *@author Thassio Carvalho <tvmcarvalho@gmail.com>
 *@revision 0.1 27/05/2012
 * 
 */

import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Toast;

public class Start extends ListActivity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle initState) {
        super.onCreate(initState);

        String[] mainmenuSTR = {"Connect!", "Adicionar SN", "Editar SN", "Configs", "Hide"};
        
        ArrayAdapter<String> menuAdapter = new ArrayAdapter<String>(this
        		, android.R.layout.simple_expandable_list_item_1, mainmenuSTR);
        
        setListAdapter(menuAdapter);
    }
    
    @Override
    protected void onListItemClick(ListView l, View v, int position, long id) {
    	// TODO Auto-generated method stub
    	super.onListItemClick(l, v, position, id);
    	
    	String item = (String)getListAdapter().getItem(position);
    	
    	if (item.equalsIgnoreCase("adicionar sn")) {
			Intent addsnact = new Intent(Start.this, AddSnAct.class);
			Start.this.startActivity(addsnact);
		}
    	
    	else if (item.equalsIgnoreCase("connect!")) {
			Intent consnact = new Intent(Start.this, Connect.class);
			Start.this.startActivity(consnact);
		}
    	else if (item.equalsIgnoreCase("editar sn")) {
			Intent edtsnact = new Intent(Start.this, EdtSnAct.class);
			Start.this.startActivity(edtsnact);
		}
    	
    	else if (item.equalsIgnoreCase("configs")) {
    		Intent cfgact = new Intent(Start.this, Configs.class);
    		Start.this.startActivity(cfgact);
		}
    	
    	else if (item.equalsIgnoreCase("hide")) {
			 Toast.makeText(this, "Hey!", Toast.LENGTH_SHORT).show();
    		
		}
    }
    
    @Override
    protected void onPause() {
    	// TODO Auto-generated method stub
    	super.onPause();
    }
}